<template>
  <h1>El-消息提示组件</h1>
  <el-button @click="f(1)">成功消息</el-button>
  <el-button @click="f(2)">警告消息</el-button>
  <el-button @click="f(3)">错误消息</el-button>
  <el-button @click="f(4)">普通消息</el-button>
  <el-button @click="f(5)">可关闭的提示消息</el-button>
</template>

<script setup>
//ElMessage第1次写需要手动导入!
import {ElMessage} from "element-plus";

const f = (x)=>{
  switch (x){
    case 1 :ElMessage.success('成功的提示消息');break;
    case 2 :ElMessage.warning('警告的提示消息');break;
    case 3 :ElMessage.error('错误的提示消息');break;
    case 4 :ElMessage('普通的提示消息');break;
    case 5 :ElMessage({message:'普通的提示消息',showClose:true});
    //case 5 :ElMessage.error({message:'普通的提示消息',showClose:true});
  }
}
</script>

<style scoped>

</style>